﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Zhongchouwwwww.Models;
using Zhongchouwwwww.DAL;
using System.Data.Common;
using System.Data.SqlClient;
using System.Data;

namespace Zhongchouwwwww.BAL
{
    public class GetDate
    {
        public static ZhongchouDBEntities db = Service.db;

        public static void SSS()
        {
            new SqlParameter("@UserName", SqlDbType.VarChar) { Value = "username" };

        }
        public static List<CommentInfoDTO> GetCommentInfoDates(string sql)
        {
            return Service.GetCommentInfoDates(sql);
        }

            public static List<ProjectinfoDTO> GetProjectList(int i)
        {
            return Service.GetProjectAllList(i);
        }

        /// <summary>
        /// 根据状态 获取项目数量
        /// </summary>
        /// <param name="i">1是所有项目 2是众筹中 3是已完成</param>
        /// <returns></returns>
        public static int GetProjectNums(int i)
        {
            return Service.GetProjectNums(i);
        }
        public static (SortedDictionary<int, List<ProjectinfoDTO>> 数据源, int 分页总数) GetProjectListByIndex(List<ProjectinfoDTO> data)
        {
           return Service.GetProjectListByIndex(data);
        }
        /// <summary>
        /// 根据类型和项目状态返回是否排序或需要查询的数据
        /// </summary>
        /// <param name="type">"全部"&{类型},项目类型</param>
        /// <param name="i">1全部2众筹中3已完成 项目状态</param>
        /// <param name="paixu">""默认排序 "收藏"收藏升序 "进度"进度升序 排序</param>
        /// <param name="sousuo">""默认不查询&{搜索词} 查询</param>
        /// <returns>返回对应数据</returns>
        public static List<ProjectinfoDTO> GetProjectListByType(string type, int state, string paixu, string sousuo)
        {
            return Service.GetProjectListByTypeStatePaixu(type, state, paixu, sousuo);
        }
        public static List<Userinfo> GetDataSource(Userinfo u)
        {
            return Service.GetDataSource(u);
        }
        public static List<Projectinfo> GetDataSource(Projectinfo p)
        {
            return Service.GetDataSource(p);
        }
        public static List<Returnsetinfo> GetDataSource(Returnsetinfo r)
        {
            return Service.GetDataSource(r);
        }
        public static List<Launchinfo> GetDataSource(Launchinfo l)
        {
            return Service.GetDataSource(l);
        }
        public static List<CollectionInfo> GetDataSource(CollectionInfo c)
        {
            return Service.GetDataSource(c);
        }
        public static List<Addressinfo> GetDataSource(Addressinfo a)
        {
            return Service.GetDataSource(a);
        }
        /// <summary>
        /// 增删改
        /// </summary>
        /// <param name="sql"></param>
        /// <param name="user">用户表操作</param>
        /// <param name="i">1增2删3改</param>
        /// <returns></returns>
        public static bool EXEXE(string sql)
        {
            return Service.EXEXE(sql);
        }

        #region 辉功能方法   
        /// <summary>
        /// 查询用户发起的项目
        /// </summary>
        /// <param name="i"></param>
        /// <param name="uind"></param>
        /// <returns></returns>
        public static List<ProjectinfoDTO> GetProjectAllList(int i, int uind)
        {
            return Service.GetProjectAllList(i, uind);
        }
        //喜欢项目
        public static List<ProjectinfoDTO> GetProjectAllList(string ia, int uind)
        {
            return Service.GetProjectAllList(ia, uind);
        }
        //支持项目
        public static List<ProjectinfoDTO> GetProjectAllList(string ia, int uind, string add)
        {
            return Service.GetProjectAllList(ia, uind, add);
        }
        //用户信息
        public static UserinfoDTO GetProjectBllList(int usid)
        {
            return Service.GetProjectBllList(usid);
        }
        //上传图片
        public static bool update(string fileName, int usid, int po)
        {
            return Service.update(fileName, usid, po);
        }
        //删除项目
        public static bool delet(string pjid)
        {
            return Service.delet(pjid);
        }
        #endregion



    }
}
